<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>

<body>
  <div id="app">
    <h1>{{count}}</h1>
    <!-- <button v-on:click="count +=1">add</button> -->
    <button v-on:click="increment()">add+1</button>
    <button v-on:click="add($event,2)">add+2</button>
    <button v-on:click="add3">add+3</button>
  </div>

  <script>


    var vm = new Vue({
      //选项
      el: "#app",
      //数据驱动视图
      data: {
        count: 0
      },
      methods: {
        increment() {
          this.count += 1;
        },
        add(event, num) {
          this.count += num;
          console.log(event)
        },
        add3(event) {
          console.log('add3', event)
        }
      }


    })



  </script>

</body>

</html>